<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
<head>
    <th:block th:include="include :: header('订单管理')" />
</head>
<body class="white-bg">
<div class="wrapper wrapper-content animated fadeInRight ibox-content" >
    <div id="msg">
        <h1>请输入密码后查看</h1>
    </div>
    <form id="form-order-add" class="form-horizontal" style="display: none;">
        <h4 class="form-header h4">订单产品详细信息</h4>
        <input id="id" th:value="*{orderId}" style="display: none">
        <div class="row">
            <div class="col-sm-6">
                <div class="form-group">
                    <label class="col-sm-4 control-label">10kv开关：</label>
                    <div class="col-sm-8">
                        <input disabled id="switch10" placeholder="请输入数量" class="form-control" type="number">
                    </div>
                </div>
            </div>
            <div class="col-sm-6">
                <div class="form-group">
                    <label class="col-sm-4 control-label">0.4kv开关：</label>
                    <div class="col-sm-8">
                        <input disabled id="switch04" placeholder="请输入数量" class="form-control" type="number">
                    </div>
                </div>
            </div>
        </div>
        <div class="row">
            <div class="col-sm-6">
                <div class="form-group">
                    <label class="col-sm-4 control-label">110kv开关：</label>
                    <div class="col-sm-8">
                        <input disabled id="switch110" placeholder="请输入数量" class="form-control" type="number">
                    </div>
                </div>
            </div>
            <div class="col-sm-6">
                <div class="form-group">
                    <label class="col-sm-4 control-label">35kv开关：</label>
                    <div class="col-sm-8">
                        <input disabled id="switch35" placeholder="请输入数量" class="form-control" type="number">
                    </div>
                </div>
            </div>
        </div>
        <div class="row">
            <div class="col-sm-6">
                <div class="form-group">
                    <label class="col-sm-4 control-label">10kv刀闸：</label>
                    <div class="col-sm-8">
                        <input disabled id="gate10" placeholder="请输入数量" class="form-control" type="number">
                    </div>
                </div>
            </div>
            <div class="col-sm-6">
                <div class="form-group">
                    <label class="col-sm-4 control-label">0.4kv刀闸：</label>
                    <div class="col-sm-8">
                        <input disabled id="gate04" placeholder="请输入数量" class="form-control" type="number">
                    </div>
                </div>
            </div>
        </div>
        <div class="row">
            <div class="col-sm-6">
                <div class="form-group">
                    <label class="col-sm-4 control-label">110kv刀闸：</label>
                    <div class="col-sm-8">
                        <input disabled id="gate110" placeholder="请输入数量" class="form-control" type="number">
                    </div>
                </div>
            </div>
            <div class="col-sm-6">
                <div class="form-group">
                    <label class="col-sm-4 control-label">35kv刀闸：</label>
                    <div class="col-sm-8">
                        <input disabled id="gate35" placeholder="请输入数量" class="form-control" type="number">
                    </div>
                </div>
            </div>
        </div>
        <div class="row">
            <div class="col-sm-6">
                <div class="form-group">
                    <label class="col-sm-4 control-label">地刀：</label>
                    <div class="col-sm-8">
                        <input disabled id="ground" placeholder="请输入数量" class="form-control" type="number">
                    </div>
                </div>
            </div>
            <div class="col-sm-6">
                <div class="form-group">
                    <label class="col-sm-4 control-label">手车双：</label>
                    <div class="col-sm-8">
                        <input disabled id="doubleHandCar" placeholder="请输入数量" class="form-control" type="number">
                    </div>
                </div>
            </div>
        </div>
        <div class="row">
            <div class="col-sm-6">
                <div class="form-group">
                    <label class="col-sm-4 control-label">手车单：</label>
                    <div class="col-sm-8">
                        <input disabled id="signleHandCar" placeholder="请输入数量" class="form-control" type="number">
                    </div>
                </div>
            </div>
            <div class="col-sm-6">
                <div class="form-group">
                    <label class="col-sm-4 control-label">电源12v1a：</label>
                    <div class="col-sm-8">
                        <input disabled id="power121" placeholder="请输入数量" class="form-control" type="number">
                    </div>
                </div>
            </div>
        </div>
        <div class="row">
            <div class="col-sm-6">
                <div class="form-group">
                    <label class="col-sm-4 control-label">电源12v2a：</label>
                    <div class="col-sm-8">
                        <input disabled id="power122" placeholder="请输入数量" class="form-control" type="number">
                    </div>
                </div>
            </div>
            <div class="col-sm-6">
                <div class="form-group">
                    <label class="col-sm-4 control-label">电源12v3a：</label>
                    <div class="col-sm-8">
                        <input disabled id="power123" placeholder="请输入数量" class="form-control" type="number">
                    </div>
                </div>
            </div>
        </div>
        <div class="row">
            <div class="col-sm-6">
                <div class="form-group">
                    <label class="col-sm-4 control-label">电源12v4a：</label>
                    <div class="col-sm-8">
                        <input disabled id="power124" placeholder="请输入数量" class="form-control" type="number">
                    </div>
                </div>
            </div>
            <div class="col-sm-6">
                <div class="form-group">
                    <label class="col-sm-4 control-label">电源12v5a：</label>
                    <div class="col-sm-8">
                        <input disabled id="power125" placeholder="请输入数量" class="form-control" type="number">
                    </div>
                </div>
            </div>
        </div>
        <div class="row">
            <div class="col-sm-6">
                <div class="form-group">
                    <label class="col-sm-4 control-label">电源12v10a：</label>
                    <div class="col-sm-8">
                        <input disabled id="power1210" placeholder="请输入数量" class="form-control" type="number">
                    </div>
                </div>
            </div>
            <div class="col-sm-6">
                <div class="form-group">
                    <label class="col-sm-4 control-label">电源12v29a：</label>
                    <div class="col-sm-8">
                        <input disabled id="power1229" placeholder="请输入数量" class="form-control" type="number">
                    </div>
                </div>
            </div>
        </div>
        <div class="row">
            <div class="col-sm-6">
                <div class="form-group">
                    <label class="col-sm-4 control-label">19位：</label>
                    <div class="col-sm-8">
                        <input disabled id="byte19" placeholder="请输入数量" class="form-control" type="number">
                    </div>
                </div>
            </div>
            <div class="col-sm-6">
                <div class="form-group">
                    <label class="col-sm-4 control-label">byte_29：</label>
                    <div class="col-sm-8">
                        <input disabled id="byte29" placeholder="请输入数量" class="form-control" type="number">
                    </div>
                </div>
            </div>
        </div>
    </form>
</div>
<th:block th:include="include :: footer" />
<script>
    var prefix = ctx + "order/face";
    $(function() {
        let id = $("#id").val();
        load(id, '');
    });

    function load(id, value){
        layer.prompt({
            title: '请输密码',
            closeBtn: 0,
            btn: ['查看'],
            scrollbar: false,
            value: value
        }, function(val, index){
            var config = {
                url: prefix+'/orderDetailByUniCode',
                type: "GET",
                dataType: "json",
                data: {
                    orderId: id,
                    uniCode: val,
                    userName: ''
                },
                beforeSend: function () {
                    $.modal.loading("正在处理中，请稍后...");
                },
                success: function(result) {
                    $.modal.closeLoading();
                    if(typeof(result.data) == 'undefined'){
                        $.modal.alertWarning("查询结果不存在，请检查输入的密码重试！", function () {
                            load(id, val);
                        })
                        return;
                    }
                    if(result.code == 0){
                        layer.close(index);
                        $("#switch10").val(result.data.switch10);
                        $("#switch04").val(result.data.switch04);
                        $("#switch110").val(result.data.switch110);
                        $("#switch35").val(result.data.switch35);
                        $("#gate10").val(result.data.gate10);
                        $("#gate04").val(result.data.gate04);
                        $("#gate110").val(result.data.gate110);
                        $("#gate35").val(result.data.gate35);
                        $("#ground").val(result.data.ground);
                        $("#doubleHandCar").val(result.data.doubleHandCar);
                        $("#signleHandCar").val(result.data.signleHandCar);
                        $("#power121").val(result.data.power121);
                        $("#power122").val(result.data.power122);
                        $("#power123").val(result.data.power123);
                        $("#power124").val(result.data.power124);
                        $("#power125").val(result.data.power125);
                        $("#power1210").val(result.data.power1210);
                        $("#power1229").val(result.data.power1229);
                        $("#byte19").val(result.data.byte19);
                        $("#byte29").val(result.data.byte29);
                        $("#form-order-add").css("display", "block");
                        $("#msg").css("display", "none");
                    }
                },
                error: function(){
                    layer.close(index);
                    $.modal.alertWarning("服务器错误，请重试！", function () {
                        load(id, val);
                    })
                    $.modal.closeLoading();
                }
            };
            $.ajax(config)
        });
    }

</script>
</body>
</html>
